public class Test28 {
    public static void permutation(char[] chars){
        if (chars == null || chars.length == 0) return;
        prumation(chars,0);
    }
    public static void prumation(char[] chars,int start){
        if (chars.length -1 == start)
            System.out.println(new String(chars)+ " ");
        char temp;
        for (int i =start;i<chars.length;i++){
            temp = chars[start];
            chars[start]  = chars[i];
            chars[i] = temp;
            prumation(chars,start+1);
            temp = chars[start];
            chars[start]  = chars[i];
            chars[i] = temp;
        }
    }

    public static void main(String[] args) {
        char[] c1 = {'a', 'b', 'c'};
        permutation(c1);
        System.out.println();
    }
}
